/*
 * Project Name spring-boot-tools
 * File Name ResponseReceiver
 * Package Name com.huxiaosu.tools.mq
 * Create Time 2024/7/9
 * Create by name：liujie
 */
package com.huxiaosu.tools.mq;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * MQ 消息监听
 *
 * @author liujie
 * @date 2024/7/9 11:16
 */
@Slf4j
@Component
public class ResponseReceiver {
    @RabbitListener(queues = "${tools.rabbitmq.response:tools.demo.response}")
    public void receiveMessage(Message message) {
        try {
            String s = new String(message.getBody());
            log.info("response message: {}", s);

        }catch (Exception e){
            log.error("response error",e);
        }

    }
}